package service

import (
	"context"
	"gitee.com/jinmingzhi/cdce-service/internal/model"
	"gitee.com/jinmingzhi/cdce-service/internal/repository"
)

type Area interface {
	FindSchoolByCourseID(ctx context.Context, course_id uint32) ([]*model.AreaSchool, error)
}

type areaImpl struct {
	AreaRepo       repository.Area
	AreaSchoolRepo repository.AreaSchool
}

func NewArea(area_repo repository.Area, area_school_repo repository.AreaSchool) Area {
	return &areaImpl{
		AreaRepo:       area_repo,
		AreaSchoolRepo: area_school_repo,
	}
}

func (a *areaImpl) FindSchoolByCourseID(ctx context.Context, course_id uint32) ([]*model.AreaSchool, error) {
	return a.AreaSchoolRepo.FindAllByRIDAndCID(ctx, 1, course_id)
}

